﻿using System.Collections.Generic;
using System.Web.UI;
using EPiServer.Core;
using OpenWaves.Navigation.Controls;

namespace $rootnamespace$.Controls
{
	public class NavigationView : NavigationView<NavigationNode>
    {
        [PersistenceMode(PersistenceMode.InnerProperty)]
        [TemplateContainer(typeof(NavigationNodeContainer<NavigationNode>))]
        public override ITemplate FirstLevelNodeTemplate
        {
            get { return base.FirstLevelNodeTemplate; }
            set { base.FirstLevelNodeTemplate = value; }
        }

        [PersistenceMode(PersistenceMode.InnerProperty)]
        [TemplateContainer(typeof(NavigationNodeContainer<NavigationNode>))]
        public override ITemplate SecondLevelNodeTemplate
        {
            get { return base.SecondLevelNodeTemplate; }
            set { base.SecondLevelNodeTemplate = value; }
        }

        [PersistenceMode(PersistenceMode.InnerProperty)]
        [TemplateContainer(typeof(NavigationNodeContainer<NavigationNode>))]
        public override ITemplate ThirdLevelNodeTemplate
        {
            get { return base.ThirdLevelNodeTemplate; }
            set { base.ThirdLevelNodeTemplate = value; }
        }

        [PersistenceMode(PersistenceMode.InnerProperty)]
        [TemplateContainer(typeof(NavigationNodeContainer<NavigationNode>))]
        public override ITemplate FourthLevelNodeTemplate
        {
            get { return base.FourthLevelNodeTemplate; }
            set { base.FourthLevelNodeTemplate = value; }
        }

        [PersistenceMode(PersistenceMode.InnerProperty)]
        [TemplateContainer(typeof(NavigationNodeContainer<NavigationNode>))]
        public override ITemplate FifthLevelNodeTemplate
        {
            get { return base.FifthLevelNodeTemplate; }
            set { base.FifthLevelNodeTemplate = value; }
        }

        [PersistenceMode(PersistenceMode.InnerProperty)]
        [TemplateContainer(typeof(NavigationNodeContainer<NavigationNode>))]
        public override ITemplate CurrentNodeTemplate
        {
            get { return base.CurrentNodeTemplate; }
            set { base.CurrentNodeTemplate = value; }
        }

        [PersistenceMode(PersistenceMode.InnerProperty)]
        [TemplateContainer(typeof(NavigationNodeContainer<NavigationNode>))]
        public override ITemplate ExpandedNodeTemplate
        {
            get { return base.ExpandedNodeTemplate; }
            set { base.ExpandedNodeTemplate = value; }
        }

        [PersistenceMode(PersistenceMode.InnerProperty)]
        [TemplateContainer(typeof(NavigationNodeContainer<NavigationNode>))]
        public override ITemplate NodeTemplate
        {
            get { return base.NodeTemplate; }
            set { base.NodeTemplate = value; }
        }
    }

    public static class NavigationNodeContainerExtensions
    {
        public static string GetNodeStateClass<T>(this NavigationNodeContainer<T> container)
        {
            return container.NodeState == NavigationNodeState.Normal ? "" : container.NodeState.ToString().ToLowerInvariant();
        }
    }
}